<?php


namespace app\api\controller\user;


use app\api\controller\Controller;
use app\api\model\UserChannel as UserChannelmodel;

class UserChannel extends Controller
{
    /* @var \app\api\model\User $user */
    private $user;
    /**
     * 构造方法
     * @throws \app\common\exception\BaseException
     * @throws \think\exception\DbException
     */
    public function _initialize()
    {
        parent::_initialize();
        $this->user = $this->getUser();   // 用户信息
    }

    public function changerate(){
        $prama = $this->request->post();
        $prama['user_id'] = ($this->user)->user_id;
        $ucmodel = new UserChannelmodel();
        if (!$ucmodel->changerate($prama)){
            return $this->renderError('费率调整失败:'.$ucmodel->getError());
        }else{
            return $this->renderSuccess(null,'费率调整成功!');
        }
    }
}